const captureTable = require('../tables/capture');
const modelObj = {
	getCapture(callback) {
		captureTable.findAll({
			order: [
				['id', 'ASC']
			]
		}).then(data => {
			callback(data);
		});
	},
	createCapture(params, callback) {
		captureTable.create(params).then(data => {
			callback(true);
		}).catch(err => {
			callback(false);
		});
	},
	updateCapture(id, params, callback) {
		captureTable.update(params, { where: { id: id } }).then(data => {
			callback(data[0]);
		});
	},
	deleteCapture(id, callback) {
		captureTable.destroy({ where: { id: id } }).then(data => {
			callback(data);
		})
	}
}
module.exports = modelObj;